using UnityEngine;
using System.Collections;

public class EnemyAttackState : State<EnemyControl>
{
    #region Singleton

    private static EnemyAttackState instance = new EnemyAttackState();
    public static EnemyAttackState Instance { get { return instance; } }
    private EnemyAttackState() { }

    #endregion

    #region State

    public override void OnEnterState(EnemyControl behaviour)
    {
        behaviour.waitTimeEndState = Time.timeSinceLevelLoad + behaviour.waitTimeAttack;
        behaviour.weapon.AttackStart();
    }

    public override void OnUpdateState(EnemyControl behaviour)
    {
        if (behaviour.waitTimeEndState <= Time.timeSinceLevelLoad)
            behaviour.State = EnemyAlertState.Instance;
    }

    public override void OnFixedUpdateState(EnemyControl behaviour)
    {
    }

    public override void OnExitState(EnemyControl behaviour)
    {
        behaviour.weapon.AttackEnd();
    }

    public override void OnCollisionState(EnemyControl behaviour, Collision other)
    {
    }

    public override void OnTriggerState(EnemyControl behaviour, Collider other)
    {
    }

    #endregion
}
